<?php
class DatabaseMysqlConnection {
	
	private $_dbConnection = NULL;
	
	private function __construct() {
		$this->openDatabaseConnection();
	}
	
	private function openDatabaseConnection() {
		$this->_dbConnection = new PDO ( 'mysql:host=localhost;dbname=sissifd_kilometerpauschale;charset=utf8', 'sissifd_kmpau', '!q14916$', array (
				PDO::ATTR_EMULATE_PREPARES => false,
				PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION 
		) );
	}
	
	public function sqlStatement($statement) {
		$result = NULL;
		
		try {
			$result = $this->_dbConnection->query($statement);	
		} catch (PDOException $ex) {
			echo $ex->getMessage();
		}
	}
	
	public function handle() {
		return $this->_dbConnection;
	}
	
	public static function get() {
		static $db = NULL;
		
		if ($db == NULL) {
			$db = new DatabaseMysqlConnection();
		} 
		
		return $db;
	}
}

?>